using System.Linq.Expressions;
using UniversalAdmin.Domain.Entities;

namespace UniversalAdmin.Domain.Repositories;

public interface IRoleRepository : IRepository<Role>
{
  // 批量获取角色
  Task<IEnumerable<Role?>> GetByIdsAsync(IEnumerable<int> ids);

  // 角色存在性检查
  Task<bool> ExistsByNameAsync(string roleName, int? excludeRoleId = 0);

  // 根据名称获取角色
  Task<Role?> GetByNameAsync(string roleName);

  // 带导航属性的查询
  Task<Role?> GetRoleWithUsersAsync(int id);
  Task<Role?> GetRoleWithMenusAsync(int id);

  // 分页查询
  Task<(IEnumerable<Role> Items, int TotalCount)> GetPagedRolesAsync(
      string? keyword = null,
      bool? isActive = null,
      int pageIndex = 1,
      int pageSize = 10,
      Expression<Func<Role, bool>>? additionalPredicate = null);
}